﻿<pfui:VsDialogWindow 
    x:Class="NuGet.Dialog.PackageManagerUI.SummaryWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:self="clr-namespace:NuGet.Dialog.PackageManagerUI"
    xmlns:resources="clr-namespace:NuGet.Dialog"
    xmlns:pfui="clr-namespace:NuGet.VisualStudio;assembly=NuGet.VisualStudio"
    xmlns:vsfx="clr-namespace:NuGet.VisualStudio;assembly=NuGet.VisualStudio"
    MinWidth="350"
    MinHeight="300"
    Width="350"
    Height="329"
    ShowInTaskbar="False"
    WindowStyle="SingleBorderWindow"
    WindowStartupLocation="CenterOwner"
    Title="{x:Static resources:Resources.Dialog_SummaryWindowTitle}"
    Background="{DynamicResource {x:Static resources:UIResources.WindowBackgroundBrushKey}}">
    
    <Window.Resources>
        <self:ProjectToIconConverter x:Key="ProjectToIconConverter" />
        <self:ProjectToDisplayNameConverter x:Key="ProjectToNameConverter" />
    </Window.Resources>
    
    <DockPanel Margin="10">
        <TextBlock DockPanel.Dock="Top" Text="{x:Static resources:Resources.Dialog_SummaryErrorMessage}" TextWrapping="Wrap" Foreground="{DynamicResource {x:Static vsfx:VsBrushes.WindowTextKey}}" />
        <Button AutomationProperties.AutomationId="OkButton" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Content="{x:Static resources:Resources.Dialog_OK}" IsDefault="True" IsCancel="True" Margin="6,6,0,3" Padding="4,0" MinWidth="60" Click="OKButtonClicked" />

        <Border 
            Margin="0,5"
            BorderThickness="1"
            BorderBrush="{DynamicResource ResourceKey={x:Static SystemColors.ActiveBorderBrushKey}}" 
            Background="{DynamicResource ResourceKey={x:Static SystemColors.WindowBrushKey}}">
            <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                <ItemsControl ItemsSource="{Binding}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Expander>
                                <Expander.Header>
                                    <DockPanel>
                                        <Image DockPanel.Dock="Left" Stretch="None" Source="{Binding Key, Converter={StaticResource ProjectToIconConverter}}" Margin="0,0,3,0" />
                                        <TextBlock Text="{Binding Key, Converter={StaticResource ProjectToNameConverter}}" FontWeight="SemiBold" />
                                    </DockPanel>
                                </Expander.Header>
                                <TextBlock Margin="10,0,0,0" Text="{Binding Value.Message, StringFormat={x:Static resources:Resources.ErrorStringFormat}}" TextWrapping="Wrap" Foreground="Red" />
                            </Expander>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
        </Border>
    </DockPanel>
</pfui:VsDialogWindow>